import { getTickerLogin } from '@/api/user'
import * as types from './mutation-types'
import { setStore } from "../utils/mUtils";

export const getTicker = async function ({ commit }, { ticket }) {
  const res = await getTickerLogin({ ticket }).then(res => res).catch(err => err)
  // console.log(res);
  // console.log(222222222222);
  // console.log(typeof (res));
  
  if (typeof (res) == 'object') {
   
    // console.log(res.data);
    // console.log(333333);
    
    if (res.data.code == '200') {
      let result = res.data.data
      setStore('sessionId', result.sessionId)
      commit(types.SET_USERINFO, result)
    } 
    // console.log(4444444444444);
    return res
  }else{
    return res
  }

  
}
export const getZkx = function ({ commit }, { name }) {


  commit(types.ZKX, { name })

}
